var gulp = require('gulp'),  
    less = require('gulp-less'),
    notify = require('gulp-notify'),
	autoprefixer = require('gulp-autoprefixer'),
    browserSync = require('browser-sync').create();
//  minifycss = require('gulp-minify-css'),
//  jshint = require('gulp-jshint'),
//  uglify = require('gulp-uglify'),
//  imagemin = require('gulp-imagemin'),
//  rename = require('gulp-rename'),
//  clean = require('gulp-clean'),
//  concat = require('gulp-concat'),
//  notify = require('gulp-notify'),
//  plumber = require('gulp-plumber')，
//  cache = require('gulp-cache'),
//  livereload = require('gulp-livereload');
    


  gulp.task("default",["testAutoFx","serve"],function  () {
    	console.log("gulp defaults task");
	})
    
    gulp.task("serve",function  () {
	    browserSync.init({
	    	server:{
	    		baseDir:'./'
	    	},
	    	startPath:'src/index.html'
	    })
	    gulp.watch("src/html/*.html", browserSync.reload);
	})
    
    gulp.task('testAutoFx', function () {
        gulp.src("src/less/*.less")
		.pipe( less() )
        .pipe( autoprefixer({
            browsers: ['last 2 versions', 'Android >= 4.0'],
            cascade: true, 
            remove:true //是否去掉不必要的前缀 默认：true 
        }))
        .pipe(gulp.dest('src/css'));
       
        gulp.watch(['src/html/*.htm','index.html'],function  () {
        	browserSync.reload()
        });
        
    })







	
 //    gulp.task("tessc",function  () {
 //    	gulp.src('src/less/*.less')
	// 	.pipe( less() )
	// 	.pipe( gulp.dest("src/css") )
	// })
    
 //    gulp.task("watch",function  () {
	//     gulp.watch("src/less/*.less",["tessc"]);
	// })

	// gulp.task("default",["tessc","watch"]);
	
	












